package com.easygem.front.service.imp;

import com.easygem.common.model.front.CustomerFollow;
import com.easygem.common.response.ActiveUser;
import com.easygem.front.mapper.CustomerFollowMapper;
import com.easygem.front.service.CustomerFollowService;
import com.easygem.front.service.base.AbstractServiceImpl;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 肖智
 * @version 1.0
 * @Description TODO
 * @date 2024/12/30
 */
@Service
public class CustomerFollowServiceImpl extends AbstractServiceImpl<CustomerFollowMapper, CustomerFollow, Integer> implements CustomerFollowService {
    @Autowired
    private CustomerFollowMapper customerFollowMapper;

    @Override
    public List<CustomerFollow> getCustomerFollowListByClientId(Long clientId) {
        return customerFollowMapper.getCustomerFollowListByClientId(clientId);
    }

    @Override
    public Integer addCustomerFollow(CustomerFollow customerFollow) {
        return customerFollowMapper.addCustomerFollow(customerFollow);
    }

    /**
     * 根据用户ID和当前时间得到提醒信息
     *
     * @return
     */
    @Override
    public List<CustomerFollow> selectCustomerFollowList() {
        //获得到登录后的用户信息，通用方式
        ActiveUser activeUser = (ActiveUser) SecurityUtils.getSubject().getPrincipal();
        return customerFollowMapper.selectCustomerFollowList(activeUser.getUser().getUserId());
    }
}
